import React from 'react'

import {
  NavBar,
  Icon,
} from 'antd-mobile';

import styles from './index.less'

export default class Header extends React.Component {
  render() {
    const { showBack, title, mode } = this.props

    return (
      <NavBar
        {...this.props}
        mode={mode ? mode : 'light'}
        icon={showBack ? <Icon type="left" /> : ''}
        onLeftClick={showBack ? this.props.goBack : null}
      >
        <div className={styles.header_title}>
          {title}
        </div>
      </NavBar>
    )
  }
}
